using System;
using UnityEngine;

namespace IQIGame.Onigao.Game
{
    [Serializable]
    public sealed class EntityGroupInfo
    {
        [SerializeField]
        private int m_Id = 0;

        [SerializeField]
        private string m_EntityTypeName = null;

        private Type m_EntityType = null;

        [SerializeField]
        private float m_InstanceAutoReleaseInterval = 60f;

        [SerializeField]
        private float m_InstanceExpireTime = 60f;

        [SerializeField]
        private int m_SameResInstanceCapacity = 1;

        [SerializeField]
        private int m_TotalInstanceCapacity = 100;

        [SerializeField]
        private bool m_DoNotAddOnInit = false;

        public int Id => m_Id;
        public float InstanceAutoReleaseInterval => m_InstanceAutoReleaseInterval;
        public float InstanceExpireTime => m_InstanceExpireTime;
        public int SameResInstanceCapacity => m_SameResInstanceCapacity;
        public int TotalInstanceCapacity => m_TotalInstanceCapacity;
        public bool DoNotAddOnInit => m_DoNotAddOnInit;

        public Type EntityType
        {
            get
            {
                if (m_EntityType == null)
                {
                    m_EntityType = Type.GetType($"{m_EntityTypeName}, IQIGameGamePlayAssembly.dll");
                }
                return m_EntityType;
            }
        }
    }
}
